import Taro, { useDidHide, useDidShow, useReady } from "@tarojs/taro"
import React, { useEffect } from "react"
import utils from "./utils/common.util"
import "./app.scss"
import UserProvider from "./components/provider/user.context"
// require("./utils/model.js")
const App: React.FC = props => {
	useDidHide(() => { })
	useReady(() => { })
	useDidShow(() => { })
	useEffect(() => {

		if (TARO_ENV === "h5") {
			//跳转pc端
			if (!utils.isMobile()) {
				location.href = "/"
			}
		}
		if (TARO_ENV === "weapp") {
			Taro.onAppHide(() => {
				// console.log(res)
			})
			Taro.onAppShow(() => {
				// console.log(res)
			})
			Taro.login().then(() => {
				// console.log(res)
			})
		}
	}, [])
	return <UserProvider>{props.children}</UserProvider>
}

export default App
